﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QFileDialog>
#include <QSettings>
#include <QFile>
#include <QDir>
#include <QButtonGroup>
#include "baiduocronline.h"
#include "screenwidget.h"
#include "parameters.h"
#include "cameraview.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
//    void changeEvent(QEvent *event);

    void reciveCapturedImage(int id, const QImage& preview);
    void readCapturedImage(int id, const QString& fileName);
    void setIniFile(const QString& api_key, const QString& secret_key);

private slots:
    void displayResult(const QString& content);

    void drawPixmap(const QPixmap& pixmap);

    void on_open_img_triggered();

    void on_act_baidu_triggered();

    void on_shot_screen_triggered();

    void on_actHelp_triggered();

    void on_actSetPara_triggered();

    void on_actAbout_triggered();

    void on_ActOpenCamera_triggered();

    void on_ActCaptrue_triggered();

    void on_ActCloseCamera_triggered();

private:
    Ui::MainWindow *ui;

    QButtonGroup* ButtonGroup = nullptr;
    QSettings* iniFile = nullptr;

    BaiduOCROnline* BaiduOCR = nullptr;
    ScreenWidget* swidget = nullptr;

    QImage Image;

    bool isScreenshot = false;
};
#endif // MAINWINDOW_H
